package com.examp.dy.dy.controller;

import com.examp.dy.dy.dao.AccountsRepository;
import com.examp.dy.dy.entities.Accounts;
import com.examp.dy.dy.entities.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class AccountsController {
    @Autowired
    AccountsRepository accountsRepository;



    @GetMapping("/management")
    public String displayAccounts(Model model){
        List<Accounts> accounts = accountsRepository.findAll();
        model.addAttribute("accounts",accounts);
        return "/main/user management";

    }
    @GetMapping("/accounts/entry")
    public String displayAccountForm(Model model){
        Accounts Baccounts=new Accounts();
        model.addAttribute("account",Baccounts);
        return "/security/register";
    }


}
